/**
 * Copyright 2010 Balaji Thennarangam.
 */
package com.kathez.business;

import java.util.List;

import com.kathez.KathezObjectFactory;
import com.kathez.Root;
import com.kathez.entity.BusinessOperable;
import com.kathez.exceptions.KathezRuntimeException;

/**
 * @author Balaji T
 *
 */
public class KathezBusinessDelegate extends Root implements IKathezDelegatableBusiness {
	
	public KathezBusinessDelegate(Class<? extends Object> callingClass) {
		super();
		if(callingClass == null)
			throw new KathezRuntimeException("No Calling class found as the input for KathezBusinessDelegate");
		this.businessObject = KathezObjectFactory.getBusinessObject(callingClass.getCanonicalName());
	}	

	private IKathezDelegatableBusiness businessObject;

	/* (non-Javadoc)
	 * @see com.kathez.business.IKathezDelegatableBusiness#callBusinessServiceByName(java.lang.String, com.kathez.entity.KathezEntity)
	 */
	@Override
	public Object callBusinessServiceByName(String serviceName,
			BusinessOperable entityObject) {
		return this.businessObject.callBusinessServiceByName(serviceName, entityObject);
	}

	/* (non-Javadoc)
	 * @see com.kathez.business.IKathezDelegatableBusiness#getNamedBusinessServices()
	 */
	@Override
	public List<String> getNamedBusinessServices() {
		return this.businessObject.getNamedBusinessServices();
	}

}
